package com.decent.manager.task;

import com.decent.manager.task.service.OrderTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author: decent Gjh
 * @date: 2022/11/03/11:24
 * @description:
 */
@Slf4j
@Component
public class OrderTask {
    private final OrderTaskService orderTaskService;

    public OrderTask(OrderTaskService orderTaskService) {
        this.orderTaskService = orderTaskService;
    }

    /**
     * 关闭超时订单的定时任务
     */
    @Scheduled(cron = "0 0/5 * * * ? ")
    public void closeOrder(){
        orderTaskService.closeOrder();
    }
}
